package com.training.java.core.collections.car.pre15;

import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

public class CarsLinkedListDemo {

	public static void main(String[] args) 
	{
		Car car1= new Car("Toyota","Corolla",2010);
		Car car2= new Car("Honda","CRV",2012);
		Car car3 = new Car("Ford","focus",2007);
		Car car4 = new Car();
		
		car1.setPrice(18000);
		car2.setPrice(25000);
		car3.setPrice(20000);
		
		List listOfCars= new LinkedList();
		
		listOfCars.add(car1);
		listOfCars.add(car2);
		listOfCars.add(car3);
		listOfCars.add(car4);
		listOfCars.add(car3);
		
		
		Iterator ite = listOfCars.iterator();
		while(ite.hasNext())
		{
		   Car car=	(Car)ite.next();
		   System.out.println("Make:  " + car.getMake());
    	   System.out.println("Model: " + car.getModel());
    	   System.out.println("Year: " + car.getYear());
    	   System.out.println("Price: " + car.getPrice());
    	   System.out.println("************"); 
    	   
		}
		
		
		
	}

}
